package com.neighbor.neighborhooduser.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neighbor.neighborhooduser.pojo.PostLikes;
import com.neighbor.neighborhooduser.pojo.Users;
import com.neighbor.neighborhooduser.service.IPostLikesService;
import com.neighbor.neighborhooduser.service.IPostsService;
import com.neighbor.neighborhooduser.service.impl.PostLikesServiceImpl;
import com.neighbor.neighborhooduser.utils.ReOpe;
import com.neighbor.neighborhooduser.utils.ResponseMsg;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 帖子点赞记录表 前端控制器
 * </p>
 *
 * @author song
 * @since 2025-09-22 09:13:04
 */
@RestController
@Slf4j
public class PostLikesController {

    @Autowired
    private ReOpe reOpe;
    @Autowired
    private IPostLikesService postLikesService;

    @Autowired
    private IPostsService postsService;

    @PostMapping("/posts/{postId}/like")
    public ResponseMsg setLike(@PathVariable Integer postId, HttpServletRequest request){


        Boolean isLiked = postLikesService.setLike(postId, request);

        return ResponseMsg.getInstance(ResponseMsg.SUCCESS,"响应成功",isLiked);
    }


}
